package com.pj.auraServer;

import java.sql.SQLException;
import java.util.HashMap;
import java.util.Properties;

import com.pj.lib.auraServer.AuraServer;
import com.pj.lib.auraServer.Log;
import com.pj.lib.auraServer.DB.PostgresDB;
import com.pj.lib.auraServer.exceptions.AuraServerException;
import com.pj.lib.auraServer.protocol.AuraServerPropertiesKeys;

public class Main {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Log.setLogCatalog("logs/");
		
		Properties pgProps = new Properties();
		pgProps.setProperty(PostgresDB.USER, "aura");
		pgProps.setProperty(PostgresDB.PASS, "aura");
		pgProps.setProperty(PostgresDB.URL, "localhost");
		pgProps.setProperty(PostgresDB.PORT, "5432");
		pgProps.setProperty(PostgresDB.SCHEMA, "aura");
		PostgresDB db;
		
		HashMap<Integer, Object> serverProps = new HashMap<Integer, Object>();
		serverProps.put(AuraServerPropertiesKeys.REFRESH_TIME, 10);
		
		
		try {
			
			db = PostgresDB.getInstance(pgProps);
			
			new AuraServer(4444, db, serverProps);
			
		} catch (AuraServerException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

}
